<template>
  <div>
    <h2>我是Home组件</h2>
    <div class="container">
      <div class="nav">
        <div>
          <router-link active-class="active" :to="{name:'news'}">新闻</router-link>
        </div>
        <div>
          <router-link active-class="active" :to="{name:'msg'}">消息</router-link>
        </div>
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
  </div>


</template>

<script>
export default {
  name: 'Home',
  mounted() {
    console.info('Home组件挂载了...')
  },
  beforeDestroy() {
    console.info('Home组件销毁了...')
  },

}
</script>

<style scoped>
.container{
  display: flex;
  width: 600px;
}
.nav {
    /* background-color: skyblue; */
    width: 200px;
    height: 400px;
}

.content {
    width: 400px;
    background-color: orange;
    height: 400px;
}

.nav a {
    display: block;
    text-decoration: none;
    height: 40px;
    width: 200px;
    line-height: 40px;
}
.active {
    background-color: rgb(32, 152, 221);
    color: white;
}
</style>